fix: xblock-poll's export to CSV feature is not working [TNL-8370] [MNG-2273]#28019
Conversation
|
Thanks for the pull request, @bradenmacdonald! I've created OSPR-5879 to keep track of it in JIRA. As a core committer in this repo, you can merge this once the pull request is approved per the core committer reviewer requirements and according to the agreement with your edX Champion. |
|
Your PR has finished running tests. There were no failures. |
saadyousafarbi
left a comment
There was a problem hiding this comment.
This looks good. @AhtishamShahid were you able to test it out with the provided Testing Instructions?
|
@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
@ormsbee, @kdmccormick: thought you might like to know that bradenmacdonald merged this pull request. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
|
@bradenmacdonald Thank you for your contribution. |
(cherry picked from commit e2a867e)
|
@bradenmacdonald could you port this changes to lilac? as part of BB-4877 |
|
@alfredchavez It looks like you already did, at https://github.com/open-craft/edx-platform/commits/alfred/code-drift-lilac.2-release right? |
|
@bradenmacdonald oh, I meant edx:open-release/lilac.master |
…feature is not working [TNL-8370] [MNG-2273] [BB-4877] ## Description This is a backport of https://github.com/edx/edx-platform/pull/28019 to the Lilac master branch, as [requested](https://github.com/edx/edx-platform/pull/28019#issuecomment-952413371) by @alfredchavez. Summary: > xblock-poll's celery task was broken, then fixed in #23700, then broken again by #25479. This fixes it again. ## Supporting information See original PR. ## Testing instructions See original PR. ## Deadline None ## Other information .
(cherry picked from commit e2a867e)
…590) Co-authored-by: Braden MacDonald <braden@opencraft.com>
Summary
xblock-poll's celery task was broken, then fixed in #23700, then broken again by #25479. This fixes it again.Description
XBlock-poll contains a feature to download a CSV of poll responses. It runs asynchronously in the LMS's celery workers.
However, we received a report (TNL-8370) that it is currently broken. Attempting to export the results to CSV only shows an error, which may appear in the UI or only in the browser console:
The reason for this error is that
xblock-poll's celery tasks (intasks.py) are not being registered. They were previously registered because the default LMS settings incommon.pyexplicitly setCELERY_IMPORTS = ('poll.tasks', ...), but https://github.com/edx/edx-platform/pull/25479 removed all explicit celery imports from settings.I think the reasoning was that all django apps would have their tasks.py auto-detected, but
pollis not a django app. I tried making the mainpoll.pyfile importtasks.py, but it appears that the LMS celery workers do not load XBlock code at all unless they have some reason to, so I couldn't find any way to register these tasks only by changing the XBlock code.I'm not sure if there's a better way to make these tasks detected, but this way definitely works.
Supporting information
Testing instructions
It took me a while to figure out how to run celery workers on the docker devstack - am I missing some documentation?
First, use
make lms-shellthen edit/edx/etc/lms.yml. Make sureCELERY_QUEUESis as follows:(for some reason, on my devstack, these all had wrong values like
edx.lms.core.defaultedx.lms.core., whileCELERY_DEFAULT_QUEUEhad a correct value, resulting in the worker never seeing the tasks)Second, add this to
lms/envs/private.py:Third, start Redis with
make redis-upFourth, restart the LMS.
Fifth: from
make lms-shell, start a celery worker withSixth: add an
xblock-pollto a course, answer it so it has some data, and try to export the CSV of results. It should fail. In the logs of the celery worker you should seeReceived unregistered task of type 'poll.tasks.export_csv_data'..Seventh: Check out this branch, and restart the celery worker. Try again - it should succeed.
Deadline
None, this has been an issue for months and there is a workaround that can be used in the meantime.
Other information
Nope.